Skip to content

20: Give the two WordPress plugin questions a folder of their own - #34

Merged
d4mation merged 3 commits into
mainfrom
20-plugin-folder
Aug 20, 2026
Merged

20: Give the two WordPress plugin questions a folder of their own#34
d4mation merged 3 commits into
mainfrom
20-plugin-folder

Conversation

@nikolaystrikhar

@nikolaystrikhar nikolaystrikhar commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

What: moves Plugin_Checker, Plugin_Deactivator, their two interfaces and Loads_Plugin_Functions into src/Plugin/ as Checker, Deactivator, Contracts\Checker_Interface and Contracts\Deactivator_Interface. No behaviour changes.

Usage:

use Nexcess\PluginAbsorber\Plugin\Contracts\Checker_Interface;

$container->singleton( Checker_Interface::class, My_Checker::class );

Why this way:

These are one subject. They are the only files that touch WordPress's own plugin functions, and the trait that pulls in plugin.php has no other consumer — so a folder, rather than two root-level classes with their interfaces in the catch-all Contracts\ and their trait in the cross-cutting Traits\.

All four class and interface names lose the Plugin_ prefix, because the folder now spells it. That renames two host seams, which is free until 1.0.0 tags and would not be after; Plugin\Plugin_Checker_Interface stutters in every name and buys nothing a host can use. The trait keeps its prefix — the folder means "a WordPress plugin", the name means "the functions in plugin.php".

src/Contracts/ is down to Activator_Interface and Provider_Interface, and the root of src/ from eleven files to seven.

Summary by CodeRabbit

  • Documentation

    • Updated architecture and extension guidance to reflect reorganized plugin checker and deactivator components.
  • Refactor

    • Reorganized plugin-related components under a dedicated namespace with clearer names.
    • Updated conflict handling and dependency bindings to use the new component contracts.
    • Preserved existing plugin checking and deactivation behavior.
  • Tests

    • Updated test coverage and fixtures to align with the reorganized plugin components and contracts.

Plugin_Checker and Plugin_Deactivator are the only files that touch WordPress's
own plugin functions, both through Traits\Loads_Plugin_Functions, and they sat
in the root of src/ beside the facades with their interfaces in src/Contracts/.
They are now src/Plugin/: Checker, Deactivator, and Contracts/ holding
Checker_Interface and Deactivator_Interface.

Both classes and both interfaces lose the Plugin_ prefix, because the folder is
now spelling it. That renames two host seams, which is free until 1.0.0 tags
and would not be after; the alternative, Plugin\Plugin_Checker_Interface,
stutters in all four names and buys nothing a host can use.

src/Contracts/ is down to Activator_Interface and Provider_Interface, and the
root of src/ to the seven files a host is likely to name.
The trait exists so that Checker and Deactivator can pull in
wp-admin/includes/plugin.php, and nothing else uses it. src/Traits/ is for
what cuts across folders, which Guards_Hook_Prefix does and this does not.

Its name keeps the Plugin_ the two classes just dropped, because it does not
mean the same thing: the folder is the subject "a WordPress plugin", and the
name is about the functions in plugin.php.
Base automatically changed from 19-registry-folder to main August 20, 2026 19:53
@d4mation
d4mation merged commit f5f8dcf into main Aug 20, 2026
5 of 6 checks passed
@d4mation
d4mation deleted the 20-plugin-folder branch August 20, 2026 19:55
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Enterprise

Run ID: 6305645c-9f95-4c66-8675-ec00e0ba769e

📥 Commits

Reviewing files that changed from the base of the PR and between d36642a and 73dda81.

📒 Files selected for processing (19)
  • CLAUDE.md
  • docs/extending.md
  • src/Conflict/Detector.php
  • src/Conflict/Gatekeeper.php
  • src/Conflict/Resolver.php
  • src/Plugin/Checker.php
  • src/Plugin/Contracts/Checker_Interface.php
  • src/Plugin/Contracts/Deactivator_Interface.php
  • src/Plugin/Deactivator.php
  • src/Plugin/Loads_Plugin_Functions.php
  • src/Provider.php
  • src/Sub_Plugin.php
  • tests/unit/Boot/SchedulerTest.php
  • tests/unit/Conflict/DetectorTest.php
  • tests/unit/Conflict/ResolverTest.php
  • tests/unit/Plugin/CheckerTest.php
  • tests/unit/Plugin/DeactivatorTest.php
  • tests/unit/ProviderTest.php
  • tests/unit/Scenario/HostTest.php

📝 Walkthrough

Walkthrough

The change moves plugin collaborators, contracts, and the loading trait into the Plugin namespace. Production dependency wiring, tests, and documentation now use the renamed classes and interfaces.

Changes

Plugin namespace reorganization

Layer / File(s) Summary
Plugin contracts and implementations
src/Plugin/...
Checker, Deactivator, their contracts, and Loads_Plugin_Functions now use the reorganized namespaces and names.
Production dependency wiring
src/Conflict/..., src/Provider.php, src/Sub_Plugin.php
Conflict components and container bindings now resolve the namespaced contracts and implementations. Documentation references use the new names.
Validation and documentation updates
tests/unit/..., CLAUDE.md, docs/extending.md
Tests, architecture documentation, extension guidance, bindings, and test doubles now use the reorganized plugin API.

Estimated code review effort: 3 (Moderate) | ~20 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 20-plugin-folder

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants